<?php
/**
 * Expression to SQL Mapper.
 * 
 * @author Patrick J. Mizer <patrick.mizer@gmail.com>
 * @package junction.expression
 */
class Junction_Expression_Mapping
{
	/**
	 * Map expression token => SQL
	 * 
	 * @var array
	 */
	private static $_map = array(
		'&&' => 'AND',
		'||' => 'OR',
		'==' => '=',
		'!=' => '!=',
		'<=' => '<=',
		'>=' => '>=',
		'<'  => '<',
		'>'  => '>',
		'!'  => '!',
		'\'' => '\'',
		'"' => '"',
		'(' => '(',
		')' => ')'
	);
	
	/**
	 * Translate a Junction Expression Token to mapped SQL
	 * 
	 * @param string
	 * @return string 
	 */
	public static function translate($token)
	{
		return (isset(self::$_map[$token]) ? self::$_map[$token] : $token);
	}
}
?>
